<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta content="telephone=no" name="format-detection" />
    <!-- 留作将来统一添加 -->
    <TEMPLATE>${TEMPLATE}</TEMPLATE>
    <title>模板html</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/aui.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/index.css">
    <link rel="stylesheet" type="text/css" href="../../css/data-flex.min.css">
    <style type="text/css">
        body {
            background: #F5F5F5;
        }

        .list-container {
            padding:  0 15px;
            background-color: #fff;
        }

        .item-container {
            height: 60px;
        }

        .icon-type {
            width: 36px;
            height: 36px;
            min-width: 36px;
            margin-right: 10px;
        }

        .flex-full {
            height: 100%;
            border-top: 1px solid #EFEFEF;
            overflow: hidden;
        }

        .item-container:first-child .flex-full {
            border-top: none;
        }

        .text-gray {
            font-size: 12px;
            color: #BFBFBF;
            min-width: fit-content;
        }

        .text-title {
            padding: 0 5px;
            font-size: 14px;
            color: #222224;
            overflow: hidden;
        }

        .icon-arrow {
            width: 15px;
            height: 15px;
            min-width: 15px;
        }
    </style>
</head>
<body>
    <div class="vueApp" v-cloak>
        <div v-if="listData.length" class="list-container">
            <div class="item-container" v-for="item,index in listData" data-flex="cross:center" @click="handleItem(index)">
                <img :src="item.questionTypeCode == 53 ? '../../image/ui/question_1.png' : '../../image/ui/question_2.png'" alt="" class="icon-type">
                <div class="flex-full" data-flex-box="1" data-flex="cross:center">
                    <div class="text-gray">题目</div>
                    <div class="text-title one-line" data-flex-box="1">{{item.questionName}}</div>
                    <img src="../../image/ui/ar_gray.png" alt="" class="icon-arrow">
                </div>
            </div>
        </div>
        <div v-else class="data-null">
            <p>您暂时没有错题</p>
        </div>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/service/service-tool.js"></script>
<script type="text/javascript" src="../../script/service/service-app.js"></script>
<script type="text/javascript" src="../../script/service/service-user.js"></script>
<script type="text/javascript" src="../../script/service/service-logic.js"></script>
<script type="text/javascript" src="../../script/jquery.min.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript">
    // html 的引号一律为双引号(""),js 为单引号('')
    var USER, $S, vm, pageParam;
    apiready = function() {
        $S = SERVICE();
        USER = USER();
        console.log(JSON.stringify(api.pageParam) + '=====pageParam');
        pageParam = api.pageParam;
        fnInit();
    };
    // 初始化
    function fnInit() {
        vm = new Vue({
            el: '.vueApp',
            data: {
                listData: []
            }
        });
        getPageData();
    }

    // 获取页面数据
    function getPageData() {
        var url = 'courseReport/findErrorQuestionReport';
        var params = {
            reportType: 7,
            unitId: pageParam.itemId,
            queryStudentId: USER.Get('custId'),
            questionTypeCode: pageParam.typeCode || '52,53,54'
        };
        var callback = function(data) {
            var dcList = data.listData.filter(function(item) {
                return item.questionTypeCode == 53;
            });
            var ydljList = data.listData.filter(function(item) {
                return item.questionTypeCode == 54;
            });
            vm.listData = dcList.concat(ydljList);
        };
        POST(url, params, callback);
    }

    function handleItem(index) {
        var item = vm.listData[index];
        fnOpenPublicWin('错题集', 'video/error_detail', {
            index: index,
            listData: vm.listData,
            catalogId: pageParam.itemId
        });
    }
</script>
</html>
